{ config, pkgs, ... }:

{
  nix.settings.experimental-features = [ "nix-command" "flakes" ];

  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  networking.hostName = "niga";
  networking.networkmanager.enable = true;
  networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Set your time zone.
  time.timeZone = "Europe/Moscow";
  
  services.pipewire = {
      enable = true;
      alsa.enable = true;
      pulse.enable = true;
   };

  virtualisation.libvirtd.enable = true;
  virtualisation.spiceUSBRedirection.enable = true;

  users.users.gg = {
     isNormalUser = true;
     extraGroups = ["wheel" "networkmanager" "wireshark" "libvirtd" "video" "adbusers"]; # Enable ‘sudo’ for the user.
     shell = pkgs.fish;
   };

   environment.systemPackages = with pkgs; [
     wget
     nmap
     neovim
     neofetch
     btop
     git
     python3
     gcc
     gnumake
     cmake
     bc
     ranger
     tree
     pciutils
     lshw
     bash
     stress
     lm_sensors
     bluez
     android-tools
     unzip
   ];

 nixpkgs.config.allowUnfree = true; 
 #  programs.nixvim.enable = true;
   programs.fish.enable = true;

  fonts = {
    fonts = with pkgs; [
      noto-fonts
      noto-fonts-cjk
      noto-fonts-emoji
      font-awesome
      source-han-sans
      source-han-sans-japanese
      source-han-serif-japanese
      source-code-pro
      nerdfonts
      terminus_font
    ];

    fontconfig.defaultFonts = {
      serif = [ "Noto Serif" "Source Han Serif" ];
      sansSerif = [ "Noto Sans" "Source Han Sans" ];
    };
  };

    security.pam.services.swaylock.text = ''
    # PAM configuration file for the swaylock screen locker. By default, it includes
    # the 'login' configuration file (see /etc/pam.d/login)
    auth include login
    '';

   services.dbus.enable = true;
       xdg.portal = {
       enable = true;
       wlr.enable = true;
    # gtk portal needed to make gtk apps happy
       extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
    };

    hardware = {
    	opengl.enable = true;
	opengl.driSupport = true;
	opengl.driSupport32Bit = true;
        
	opengl.extraPackages = with pkgs; [
	     intel-media-driver
	     vaapiIntel
	     vaapiVdpau
	     libvdpau-va-gl
	];

	bluetooth.enable = true;
    };

# Enable the OpenSSH daemon.
  services.openssh.enable = true;
 
  services.openssh.settings = {
       PasswordAuthentication = false;
  };

   users.users."gg".openssh.authorizedKeys.keys = [
       "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDCYTYvhOysYJUUnbuysEvhVLENva45uLOsWeqbVoQXrHkeBm5xSf4bA9P7u65zkYhK8kBe8UGuyLKXAyRCpBLIGARpviSEeGhOeE328y0B76aEgQ9G7p9uiC2KVzr/9Gy9dgMH6AHzqWGMdE0QP7HkKYsAKdKDZ6TsZAFvpo2W+DauRMuzJXxOUglgeEnN/gb1gHZnyG+q1oX4sTOpYxVop4BV0XjYSKsg+hB2hQGZrq6+3kGSIQL/UI4QvRy2gUToyggoQKddizvJJBceXTmywpF26rTWdWsnTAXBLjkf6+EbVh2sFjeiJo4iKns7GqtiizzeJqDsGne6FA9QgZPNsCGl65Xh4qklFuFMeWNvwYbnpY61Ucv3k0fn9DQ1tt2EaLgM/A9L43bjeKEekdRZdKmTGWrqhWJ8JaYGO2cx4M5xdlYjgCsfSnw8VYvJJAPocDk//HcpgYtGRW/MwzFsQVJ2ZGFuhj6UBurkpyOlSrDn5BMmfQ6jGRi3etdn/pM= u0_a139@localhost"
  ];

  services.xserver.libinput.enable = true;

  services.udev.packages = [ pkgs.android-udev-rules ];

  services.yggdrasil.enable = true;

  services.yggdrasil.settings = {
  	Peers = [
    	   "tcp://yggno.de:18226"
    	   "tls://yggno.de:18227"
    	   "tcp://188.225.9.167:18226"
    	   "tls://188.225.9.167:18227"

	   "tcp://45.147.200.202:12402"
	   "tcp://[2a00:b700::a:279]:12402"
	   "tls://45.147.200.202:443"
	   "tls://[2a00:b700::a:279]:443"
	];
  };

#systemd.services.ly = {
#      enable = true;
#};

  system.stateVersion = "23.05"; # Did you read the comment? --Yes!

}

